﻿<cfsilent>
	<cfscript>
		
		event.setArg("pageTitle", "教学运行管理 - 排课");

		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		propAdvice = getProperty("serviceFactory").getBean("termPropertyAdvice");

		sql = "	SELECT
					t.term_id,t.academic_year,t.academic_term,t.term_prop
				FROM
					t_term t
				WHERE
					SUBSTR(t.term_prop,1,1) = '1' OR SUBSTR(t.term_prop,2,1) = '1'
				ORDER BY
					t.term_id";
		
		queryObj = new Query(datasource = application.dnsSlave);
		rs_term = queryObj.execute( sql = sql ).getResult();
		
		if( rs_term.recordCount eq 0 ) {
			sql = "	SELECT
						t.term_id,t.academic_year,t.academic_term,t.term_prop
					FROM
						t_term t
					WHERE
						SUBSTR(t.academic_year,1,4) > :yearStart  AND SUBSTR(t.academic_year,1,4) < :yearEnd 
					ORDER BY
						t.term_id";

			queryObj = new Query(datasource = application.dnsSlave);
			queryObj.addParam(name = "yearStart", value = year(now())-2, cfsqltype = "cf_sql_char");
			queryObj.addParam(name = "yearEnd", value = year(now())+1, cfsqltype = "cf_sql_char");
			rs_term = queryObj.execute( sql = sql ).getResult();
			
		}

		targetArgs = structNew();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 course"></i>排课
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<div class="noticeBlock">
					<h3>选择学年学期</h3>
					<p><span class="img icon16x16 message"></span>通常课程教学安排会在学期开始前进行, 排课中有 "当前学期" 和 "排课学期" 两个不同的时间概念. 请选择您当前要操作的学年学期.</p>
					<ol>
						<cfloop query="rs_term">
							<cfset structInsert(targetArgs, "TID", rs_term.term_id, true) />
							<cfset propAdvice.parseProperty(rs_term.term_prop) />
							
							<li class="friendly">
								<span class="img icon10x10 execute"></span>
								<a rowid="<cfoutput>#rs_term.term_id#</cfoutput>" href="<cfoutput>#buildURL('taskReinit', targetArgs)#</cfoutput>"><cfoutput>#rs_term.academic_year#</cfoutput>学年 - <cfoutput>#dictAdvice.getTerm(rs_term.academic_term)#</cfoutput></a>
								<span><cfif propAdvice.getRunning()>(当前学期)</cfif></span>
							</li>
						</cfloop>
					</ol>
				</div>
				
			</div>
		</li>
	</ul>
</div>
